package cn.hxzy.mapper;

import cn.hxzy.domain.ClassTable;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface ClassTableMapper extends BaseMapper<ClassTable> {


    /**
     * 根据班级Id修改班级名称
     * @param classId
     * @param className
     * @return
     */
    @Update("UPDATE sys_class SET class_name=#{className} WHERE class_id=#{classId}")
    int updateClass(@Param("classId") Integer classId,@Param("className") String className);


    /**
     * 模糊查询班级
     * @param className
     * @return
     */
    @Select("SELECT * FROM `sys_class` WHERE class_name like CONCAT('%',#{className},'%')")
    List<ClassTable> selectClass(String className);

}
